import Vue from 'vue'
import Router from 'vue-router'

import Main from "../views/Main";
import Login from "../views/Login";
import UserAdd from "../views/user/Add";
import UserList from "../views/user/List";
import NotFount from "../views/404"

/*使用路由*/
Vue.use(Router);

/*配置路由*/
export  default new Router({
  mode: 'history',
  routes: [
    {
      name: 'Main',
      path: '/main',
      component: Main,
      children: [
        {
          name: 'UserAdd',
          path: '/user/add/:id',
          component: UserAdd
        },
        {
          name: 'UserList',
          path: '/user/list/:id',
          component: UserList,
          props: true
        }
      ],

    },
    {
      name: 'Login',
      path: '/login',
      component: Login
    },
    /*404页面不存在*/
    {
      path: '*',
      component: NotFount
    },
    {
      path: "/home",
      redirect: '/main'
    }
  ]
})
